home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
401_500
/
DISK0424
/
DISK0424.ZIP
/
ZELLER.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1985-08-20
|
768b
|
39 lines
program zeller(input, output);
{$t+ }
var day, month, year,
zday, m, y1, y2 : integer;
begin
writeln('This program computes the day of the Week from the Date');
writeln;
write('Enter month:');
read(month);
writeln;
write('Enter day:');
read(day);
writeln;
write('Enter year:');
read(year);
if month < 3
then begin
m:=month + 10;
year:=year - 1
end else
m:=month - 2;
y1:=year div 100;
y2:=year mod 100;
zday:=(day + trunc(2.6*m - 0.1)
+ y2 + y2 div 4
+ y1 div 4 - 2*y1 + 49) mod 7;
writeln;
write('Day of the week (0=Sun, 6=Sat):',zday)
end.
4
+ y1 div 4 - 2*y1 + 49) mod 7;
writeln;